package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.entity.TextEvaluation;
import com.wuseguang.springcloud.service.TextEvaluationService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 评价表 前端控制器
 * </p>
 *
 * @author 
 * @since 2020-02-12
 */
@RestController
@RequestMapping("/textEvaluation")
public class TextEvaluationController {


    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private TextEvaluationService textEvaluationServiceImpl;

    /**
     * 给学生添加文字点评
     * @param request
     * @param textEvaluation 点评信息
     * @return
     */
    @RequestMapping("/addTextEvaluation")
    public Result addTextEvaluation(RequestParameterWrapper request ,TextEvaluation textEvaluation){
        logger.info("给学生添加文字点评");

        //获取教师id
        String teacherId = request.getParam("teacherId");
        //获取教师姓名
        String teacherName =  request.getParam("teacherName");
        //赋值
        textEvaluation.setTeacherId(Integer.valueOf(teacherId));
        textEvaluation.setTeacherName(teacherName);

        return textEvaluationServiceImpl.addTextEvaluation(textEvaluation);
    }
}

